<template>
  <div>
    <NavBar :title="title" />
    <div class="content-top">
      <!-- 自我评价 -->
      <div class="resume-edit-myself">
        <van-field v-model="text" show-word-limit maxlength="500" rows="15" autosize type="textarea" placeholder="请输入自我评价" style="border-radius: 10px;margin-bottom: 20px;font-size: 16px;color: #333;line-height: 22px;" />
        <van-button type="primary" block color="#05A6F0" :loading="loading_submit" round style="font-size: 18px" text="保存" :disabled="text === ''" @click="onSubmit"></van-button>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from '@/components/NavBar.vue'
import { Button, Field, Toast } from "vant";
import Global from '@/Global';
export default {
  name: 'ResumeSelf',
  components: {
    NavBar,
    [Button.name]: Button,
    [Field.name]: Field,
  },
  props: ['title', 'data'],
  mounted() {
    this.$api.get('/Resume/GetEvaluation').then(res=>{
			if(res.success){
				this.text = res.response.evaluation;
			}
		})
  },
  // 定义属性
  data() {
    return {
      text: '',
      loading_submit: false
    }
  },
  // 方法集合
  methods: {
    onSubmit() {
      this.loading_submit = true;
			this.$api.post('/Resume/SaveEvaluation',{evaluation:this.text}).then(res=>{
				this.loading_submit = false;
				if(res.success){
					Toast.success('保存成功');
					this.$bus.$emit(Global.bus_person_resume_update, 'ok');
					this.$router.go(-1);
				}
			})
    }
  },
}
</script>

<style scoped>
.resume-edit-myself {
  padding: 15px;
}

.resume-edit-myself .van-cell::after {
  display: none;
}
</style>